package com.javafm.vertx;

import io.vertx.core.AbstractVerticle;
import io.vertx.core.http.HttpServer;
import io.vertx.core.http.HttpServerResponse;

/**
 * @Classname SimpleHttpServerVerticle
 * @Description TODO
 * @Date 2020-08-14 20:23
 * @Created by Lemon
 */
public class SimpleHttpServerVerticle extends AbstractVerticle {

    @Override
    public void start() throws Exception {
        HttpServer server = vertx.createHttpServer();
        server.requestHandler(req -> {
            HttpServerResponse response = req.response();
            response.putHeader("content-type", "text/plain");
            response.end("Hello World");
        });


        server.listen(8080);
    }
}
